#include <iostream>
#include <iomanip>
#include <sstream> //字符串流
using namespace std;

//键盘输入
void get_cin()
{

	//char ch[1024];
	//cin >> ch;
	//cout << ch << endl;


	//char ch1 = cin.get();
	//cout << ch1 << endl;
//	cout.put(ch1);

	char str[20] = {50};
	cin.getline(str,50);

	cout << str << endl;
}

//屏幕输出
void screen_out()
{
	cout.put('A').put('B').put('C');
	char str[] = {"asdfas23sdfasdfsdf"};
	cout.write(str,sizeof(str));
	cout <<"\n"<< str << endl;

	//16进制
//	cout.setf(ios::hex,ios::basefield);
	cout << hex << 123 << endl;
	//八进制
	cout << oct << 123 << endl;

	//10进制
	cout.setf(ios::dec,ios::basefield);

	//控制有效数位数
	cout << setprecision(5) << 0.0215485212 << endl;

	//设置宽度
	cout.width(10);
	cout.fill('*');
	//cout.setf(ios::right);
	cout.setf(ios::left);
	cout << "1234123" << endl;
}

//设置进制
void set_jinzhi()
{
	int num1;
	cin.setf(ios::hex,ios::basefield);//设置输入为16进制
	cin >> num1;
	//16进制
	//	cout.setf(ios::hex,ios::basefield);

	// 10进制
	cout.setf(ios::dec, ios::basefield);
	cout << num1;
}

void test1()
{
	double db = 100 / 1.9;
	cout.setf(ios::fixed | ios::showpoint);
	cout << db << endl;
	cout.setf(ios::scientific, ios::fixed|ios::showpoint);

	cout << db << endl;
}


struct Str_struct
{
	string str1, str2, str3;
	double db;
	int num;
	char ch;
};

//字符串输入输出
void test_string()
{
	string str("China google microsoft 12.9 123 A");

	Str_struct  struct1;
	istringstream input(str);//创建一个字符串扫描流
	input >> struct1.str1 >> struct1.str2 >> struct1.str3 >> struct1.db >> struct1.num >> struct1.ch;
	cout << struct1.str1 << endl;
	cout << struct1.str2 << endl;
	cout << struct1.str3 << endl;
	cout << struct1.db << endl;
	cout << struct1.num << endl;
	cout << struct1.ch << endl;

	ostringstream out;//字符串输出流
	char str2[100] = {0};
	out << "awdf" << "234" << "wer34" << "34ewfdsa" << endl;
	string mystr = out.str();
	cout << mystr;
}

void main1()
{
	//get_cin();
	//screen_out();
	//test1();
	test_string();
	system("pause");
}